<?php
$port = 10240;
$ip = "socket.evildao.com";

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) {
    echo "socket_create() failed: reason: " . socket_strerror($socket) . "\n";
}
echo "Connent $ip:$port...";
$result = socket_connect($socket, $ip, $port);
if ($result < 0) {
    echo "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
}else {
    echo "OK\n";
}
while(1) {
	$out = socket_read($socket, 65536);
	if($out != false) {
		echo $out."\n";
	}  
}
echo "close...\n";
socket_close($socket);